home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windows 95 API Bible
/
Windows 95 API Bible 3 Disc Set.iso
/
Win32 API Bible Book 1 of 3
/
CHAPTE22
/
EX9.C
< prev
Wrap
C/C++ Source or Header
|
1995-05-29
|
2KB
|
53 lines
#include <genstub.c>
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_COMMAND:
switch ( LOWORD( wParam ) )
{
case IDM_TEST:
{
TCHAR szXlatChars[32];
TCHAR szBuffer[128];
int iBytesNeeded;
// Make an ANSI string of characters to translate,
static TCHAR szAccentedChars[] = { 0xe1, 0xe2,
0xe7, 0xe8,
0xed, 0xec, 0
};
// Get space needed
iBytesNeeded = FoldString( MAP_COMPOSITE,
szAccentedChars, -1, 0, 30 );
if ( GetLastError() == ERROR_SUCCESS )
FoldString( MAP_COMPOSITE, szAccentedChars, -1,
szXlatChars, 30 );
else
{
wsprintf(szBuffer, "Last error: %d", GetLastError());
MessageBox( hWnd, szBuffer, "Error", MB_OK );
}
if (GetLastError()==ERROR_SUCCESS) {
wsprintf( szBuffer, "Result: %d, Buffer: %s",
iBytesNeeded, szXlatChars );
MessageBox( hWnd, szBuffer,
"Fold String Test", MB_OK );
}
}
break;
case IDM_EXIT:
DestroyWindow( hWnd );
break;
}
break;
case WM_DESTROY:
PostQuitMessage( 0 );
break;
default:
return( DefWindowProc( hWnd, uMsg, wParam, lParam ) );
}
return( NULL );
}